package com.lifq.flink.table

import org.apache.flink.streaming.api.scala.{StreamExecutionEnvironment, createTypeInformation}
import org.apache.flink.table.api.bridge.scala.{StreamTableEnvironment, dataStreamConversions}

/**
 * @Author: LiFuqiang
 * @Date: 2022/8/2 16:08
 * @Version 1.0 
 * @description
 */
object SecondTableApp {
  def main(args: Array[String]): Unit = {
    // set up the Scala DataStream API
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    // set up the Scala Table API
    val tableEnv = StreamTableEnvironment.create(env)

    //tableEnv.createTemporaryTable("")

    val orderA = env
      .fromCollection(Seq(Order(1L, "beer", 3), Order(1L, "diaper", 4), Order(3L, "rubber", 2)))
      .toTable(tableEnv)

    val orderB = env
      .fromCollection(Seq(Order(2L, "pen", 3), Order(2L, "rubber", 3), Order(4L, "beer", 1)))
      .toTable(tableEnv)



  }

  case class Order(user: Long, product: String, amount: Int)
}
